<?php 
include '../../../php/conn.php'; 
if ($con) {
	if ($_POST) {
		
		$TMuer= $_POST['TMuer'];
		$Aduerpwd= $_POST['Aduerpwd'];
		$TMPsswored= $_POST['TMPsswored'];
		$TMPictru = 'morenuernimgs.jpg';
		$TMsex= $_POST['TMsex'];
		$TMage= $_POST['TMage'];
		$CMid= $_POST['CMid'];
		$STid= $_POST['STid'];
		$DTid= $_POST['DTid'];
		$TMTime= date('y-m-d H:I:S');
	 //查询是否添加过
//	 SELECT *
//FROM `subjectstable`
//WHERE STbname = '语文'
		$masql = "SELECT * FROM  `teachermanagement` WHERE Aduerpwd ='$Aduerpwd'"; 
		$msy=mysql_query($masql); 
		if ($msy) {
			$mynamesql = mysql_num_rows($msy);
			if ($mynamesql==1) {
				 
				//已有该数据
				echo '{"status":"100"}';
				
			} else {
				 
				 //没有此数据时执行新增
				$sql ="INSERT INTO `teachermanagement`(`TMid`, `TMuer`, `Aduerpwd`, 
				`TMPsswored`, `TMPictru`, `TMsex`, `TMage`, `CMid`, `STid`, 
				`DTid`, `TMClassify`, `TMtime`) VALUES 
				(0,'$TMuer','$Aduerpwd','$TMPsswored','$TMPictru',
				$TMsex,$TMage,$CMid,$STid,$DTid,
				1,'$TMTime')";
				//执行
				$rs = mysql_query($sql);
				if ($rs) { 
					 //新增成功 
					 echo '{"status":"200"}';
				}else
					{
						//新增失败
				echo '{"status":"404"}';
					}
				 
			} 

		} else {
			//sql语句错误
			echo '{"status":"501"}';
		} 
	}  
    
}
//关闭数据库
mysql_close($con);
?>